package com.yanmaohu.yulia.bean;

import com.yanmaohu.yulia.statement.SqlExecutableStatement;

/**
 * @author Bright Lee
 */
public final class SqlRoutineSpec implements RoutineBody {

    private int beginIndex;
    private int endIndex;
    private RightsClause rightsClause;
    private SqlExecutableStatement sqlRoutineBody;

    public SqlRoutineSpec(RightsClause rightsClause, SqlExecutableStatement sqlRoutineBody) {
        this.beginIndex = rightsClause != null ? rightsClause.getBeginIndex() : sqlRoutineBody.getBeginIndex();
        this.endIndex = sqlRoutineBody.getEndIndex();
        this.rightsClause = rightsClause;
        this.sqlRoutineBody = sqlRoutineBody;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public RightsClause getRightsClause() {
        return rightsClause;
    }

    public SqlExecutableStatement getSqlRoutineBody() {
        return sqlRoutineBody;
    }

}
